<template>
	<view class="p_flex" :class="classMargin">
		<image src="https://dy.sykj365.com/uploads/mini/file@2x.png" mode="aspectFill" class="p_img_64 p_margin_r_16">
		</image>
		<view class="p_flex_1">
			<view class="p_flex">
				<view class="p_flex_1 p_font_32" style="width: 0; word-wrap: break-word;">{{item.name}}</view>
				<view class="price" v-if="priceNum || fileNum">
					<view class="p_font_28" v-if="priceNum">
						<text
							class="fuhao">¥</text>{{fileNum?item.price: (Number(item.price) * Number(item.num)).toFixed(2)}}
					</view>
					<view class="p_font_24 p_color_7a p_margin_l_16" style="line-height: 44rpx;" v-if="fileNum">
						x{{item.num}}
					</view>
				</view>
			</view>
			<view class="p_margin_t_8" :class="previewLocation === 'right'?'p_flex': ''">
				<view class="p_font_24 p_color_b2 p_flex_1" v-if="!item.paper">请设置打印参数</view>
				<view class="p_font_28 p_color_b2 p_flex_1" v-else>
					{{item.brand}}/{{item.colour}}
				</view>
				<view class="yulan p_font_26 p_color_7a"
					:style="previewLocation === 'bottom'?'margin: 16rpx 0 0 auto': ''" v-if="isPreview"
					@click="getLookFile">预览</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		props: {
			classMargin: {
				type: String,
				default: ''
			},
			priceNum: {
				type: Boolean,
				default: false
			},
			fileNum: {
				type: Boolean,
				default: false
			},
			isPreview: {
				type: Boolean,
				default: false
			},
			previewLocation: {
				type: String,
				default: 'bottom'
			},
			item: {
				type: Object,
				default: {}
			}
		},
		methods: {
			getLookFile() {
				let self = this;
				getApp().getSeeFile(self.item.file);
			},
			getD(e) {
				if (e == 0) return '单面';
				if (e == 1) return '双面';
				if (e == '') return '';
			},
			getType(item) {
				let t_ = [];
				let s_ = '';
				if (item.cover_type) t_.push(item.cover_type)
				if (item.film_covering) t_.push(item.film_covering)

				if (t_.length > 0) {
					s_ = (t_.join('·'))
				}

				return s_
			},
		}
	}
</script>

<style lang="less">
	.price {
		width: 100rpx;
		height: 44rpx;
		display: flex;
		align-items: flex-end;
		justify-content: flex-end;

		.fuhao {
			font-size: 20rpx;
			line-height: 38rpx;
			margin-right: 8rpx;
		}
	}

	.yulan {
		width: 100rpx;
		height: 52rpx;
		display: flex;
		align-items: center;
		justify-content: center;
		box-sizing: border-box;
		border: 1px solid #E8E8E8;
		border-radius: 80rpx;
		margin-left: 46rpx;
	}
</style>
